# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=dirscanner
pkgver=0.1
pkgrel=6
groups=('blackarch' 'blackarch-scanner' 'blackarch-webapp')
pkgdesc='This is a python script that scans webservers looking for administrative directories, php shells, and more.'
arch=('any')
url='http://packetstormsecurity.com/files/117773/Directory-Scanner-Tool.html'
license=('unknown')
depends=('python2')
source=('https://dl.packetstormsecurity.net/UNIX/scanners/Scanner.tar.gz')
sha512sums=('7c62ebb768706a382b1c704b52b2276168c270729aebf8bb050e98a5136371eab91b9f900f16bf61decec3b0da2298625084e8c4c5601405a86a965f4b30dc0b')

prepare() {
  cd DirScanner

  sed -i '1i\#!/usr/bin/env python2' scanner.py
}

package() {
  cd DirScanner

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 "Read Me" "$pkgdir/usr/share/doc/$pkgname/README"
  install -m 644 "about us" "$pkgdir/usr/share/doc/$pkgname/aboutus"

  rm -rf "Read Me" "about us"

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 scanner.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

